using System;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Collections.Generic;
using System.Reflection;

namespace Xdt.Fnb.Data
{
  /// <summary>
  /// ReportsFoldersReadyForMerging Data Object Class
  /// </summary>
  public partial class DOReportsFoldersReadyForMerging
  {
    #region Class Constant declarations
    		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging tuser
		/// </summary>
		public const string Rowtuser = "tuser";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging FILENO
		/// </summary>
		public const string RowFILENO = "FILENO";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_id
		/// </summary>
		public const string Rowd_id = "d_id";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_folder
		/// </summary>
		public const string Rowd_folder = "d_folder";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_loc
		/// </summary>
		public const string Rowd_loc = "d_loc";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging ILPNO
		/// </summary>
		public const string RowILPNO = "ILPNO";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging a_code
		/// </summary>
		public const string Rowa_code = "a_code";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging a_desc
		/// </summary>
		public const string Rowa_desc = "a_desc";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging a_from
		/// </summary>
		public const string Rowa_from = "a_from";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging a_to
		/// </summary>
		public const string Rowa_to = "a_to";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_status
		/// </summary>
		public const string Rowd_status = "d_status";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_match
		/// </summary>
		public const string Rowd_match = "d_match";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_exist
		/// </summary>
		public const string Rowd_exist = "d_exist";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging FSTATUS
		/// </summary>
		public const string RowFSTATUS = "FSTATUS";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging LOCNO
		/// </summary>
		public const string RowLOCNO = "LOCNO";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_accno
		/// </summary>
		public const string Rowd_accno = "d_accno";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_doctype
		/// </summary>
		public const string Rowd_doctype = "d_doctype";

		/// <summary>
		/// The Table Column for the ReportsFoldersReadyForMerging d_lasttran
		/// </summary>
		public const string Rowd_lasttran = "d_lasttran";


#region Stored Procedures
private const string m_StoredProcedureConstRetrieveall = "spReportsFoldersReadyForMerging_Retrieveall";
#endregion
    
    
    #endregion

    #region Class Variable declarations
    	#region DO Variables
		private string m_tuser;
		private string m_FILENO;
		private string m_d_id;
		private string m_d_folder;
		private string m_d_loc;
		private string m_ILPNO;
		private string m_a_code;
		private string m_a_desc;
		private string m_a_from;
		private string m_a_to;
		private string m_d_status;
		private bool m_d_match;
		private bool m_d_exist;
		private string m_FSTATUS;
		private string m_LOCNO;
		private string m_d_accno;
		private string m_d_doctype;
		private DateTime m_d_lasttran;
	#endregion
    
	#region Default Variables
	private SQLDataObject sqlData;
	private List<DOReportsFoldersReadyForMerging> m_ReportsFoldersReadyForMergings = new List<DOReportsFoldersReadyForMerging>();
	#endregion
	
    #endregion

    #region Class Constructors & Destructors
    /// <summary>
    /// Class Constructor
    /// </summary>
    public DOReportsFoldersReadyForMerging() { }
    #endregion

    #region Class Properties
    #region DO Properties
		/// <summary>
		/// tuser
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging tuser
		/// </remarks>
		public string tuser
		{
			get { return (this.m_tuser); }
			set { this.m_tuser = value; }
		}

		/// <summary>
		/// FILENO
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging FILENO
		/// </remarks>
		public string FILENO
		{
			get { return (this.m_FILENO); }
			set { this.m_FILENO = value; }
		}

		/// <summary>
		/// d_id
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_id
		/// </remarks>
		public string d_id
		{
			get { return (this.m_d_id); }
			set { this.m_d_id = value; }
		}

		/// <summary>
		/// d_folder
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_folder
		/// </remarks>
		public string d_folder
		{
			get { return (this.m_d_folder); }
			set { this.m_d_folder = value; }
		}

		/// <summary>
		/// d_loc
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_loc
		/// </remarks>
		public string d_loc
		{
			get { return (this.m_d_loc); }
			set { this.m_d_loc = value; }
		}

		/// <summary>
		/// ILPNO
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging ILPNO
		/// </remarks>
		public string ILPNO
		{
			get { return (this.m_ILPNO); }
			set { this.m_ILPNO = value; }
		}

		/// <summary>
		/// a_code
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging a_code
		/// </remarks>
		public string a_code
		{
			get { return (this.m_a_code); }
			set { this.m_a_code = value; }
		}

		/// <summary>
		/// a_desc
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging a_desc
		/// </remarks>
		public string a_desc
		{
			get { return (this.m_a_desc); }
			set { this.m_a_desc = value; }
		}

		/// <summary>
		/// a_from
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging a_from
		/// </remarks>
		public string a_from
		{
			get { return (this.m_a_from); }
			set { this.m_a_from = value; }
		}

		/// <summary>
		/// a_to
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging a_to
		/// </remarks>
		public string a_to
		{
			get { return (this.m_a_to); }
			set { this.m_a_to = value; }
		}

		/// <summary>
		/// d_status
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_status
		/// </remarks>
		public string d_status
		{
			get { return (this.m_d_status); }
			set { this.m_d_status = value; }
		}

		/// <summary>
		/// d_match
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_match
		/// </remarks>
		public bool d_match
		{
			get { return (this.m_d_match); }
			set { this.m_d_match = value; }
		}

		/// <summary>
		/// d_exist
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_exist
		/// </remarks>
		public bool d_exist
		{
			get { return (this.m_d_exist); }
			set { this.m_d_exist = value; }
		}

		/// <summary>
		/// FSTATUS
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging FSTATUS
		/// </remarks>
		public string FSTATUS
		{
			get { return (this.m_FSTATUS); }
			set { this.m_FSTATUS = value; }
		}

		/// <summary>
		/// LOCNO
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging LOCNO
		/// </remarks>
		public string LOCNO
		{
			get { return (this.m_LOCNO); }
			set { this.m_LOCNO = value; }
		}

		/// <summary>
		/// d_accno
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_accno
		/// </remarks>
		public string d_accno
		{
			get { return (this.m_d_accno); }
			set { this.m_d_accno = value; }
		}

		/// <summary>
		/// d_doctype
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_doctype
		/// </remarks>
		public string d_doctype
		{
			get { return (this.m_d_doctype); }
			set { this.m_d_doctype = value; }
		}

		/// <summary>
		/// d_lasttran
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsFoldersReadyForMerging d_lasttran
		/// </remarks>
		public DateTime d_lasttran
		{
			get { return (this.m_d_lasttran); }
			set { this.m_d_lasttran = value; }
		}
		#endregion
    
	#region Default Properties
	public List<DOReportsFoldersReadyForMerging> ReportsFoldersReadyForMergings
	{
	  get { return m_ReportsFoldersReadyForMergings; }
	  set { m_ReportsFoldersReadyForMergings = value; }
	}    
	#endregion
	
    #endregion

    #region Class Methods
    public bool Retrieve()
    {
      sqlData = new SQLDataObject();
      DataSet resultDS = sqlData.ExecuteDataSetSQL(m_StoredProcedureConstRetrieve + " @" + Rowd_id + "=" + this.d_id);
      return SetClassPropertiesFromDataSet(resultDS);
    }

    public bool RetrieveAll()
    {
      sqlData = new SQLDataObject();
      string sVariables = sqlData.GetVariables(this);

      DataSet resultDS = sqlData.ExecuteDataSetSQL(m_StoredProcedureConstRetrieveall + " " + sVariables.Substring(0, sVariables.Length - 2));
      return SetClassPropertiesListFromDataSet(resultDS);
    }

    public bool Create()
    {
      bool success = false;
      sqlData = new SQLDataObject();
      string sVariables = sqlData.GetVariables(this);

      success = sqlData.ExecuteNonQuerySQL(m_StoredProcedureConstCreate + " " + sVariables.Substring(0, sVariables.Length - 2));

      return success;
    }

    public bool Update()
    {
      bool success = false;
      sqlData = new SQLDataObject();

      string sVariables = sqlData.GetVariables(this);

      success = sqlData.ExecuteNonQuerySQL(m_StoredProcedureConstUpdate + " " + sVariables.Substring(0, sVariables.Length - 2));

      return success;
    }

    private bool SetClassPropertiesFromDataSet(DataSet resultDS)
    {
      bool success = false;
      if (resultDS.Tables[0] != null)
      {
        if (resultDS.Tables[0].Rows.Count > 0)
        {
          foreach (DataRow dr in resultDS.Tables[0].Rows)
          {
					if (dr[Rowtuser].ToString() != "")
			this.tuser = dr[Rowtuser].ToString();

		if (dr[RowFILENO].ToString() != "")
			this.FILENO = dr[RowFILENO].ToString();

		if (dr[Rowd_id].ToString() != "")
			this.d_id = dr[Rowd_id].ToString();

		if (dr[Rowd_folder].ToString() != "")
			this.d_folder = dr[Rowd_folder].ToString();

		if (dr[Rowd_loc].ToString() != "")
			this.d_loc = dr[Rowd_loc].ToString();

		if (dr[RowILPNO].ToString() != "")
			this.ILPNO = dr[RowILPNO].ToString();

		if (dr[Rowa_code].ToString() != "")
			this.a_code = dr[Rowa_code].ToString();

		if (dr[Rowa_desc].ToString() != "")
			this.a_desc = dr[Rowa_desc].ToString();

		if (dr[Rowa_from].ToString() != "")
			this.a_from = dr[Rowa_from].ToString();

		if (dr[Rowa_to].ToString() != "")
			this.a_to = dr[Rowa_to].ToString();

		if (dr[Rowd_status].ToString() != "")
			this.d_status = dr[Rowd_status].ToString();

		if (dr[Rowd_match].ToString() != "")
			this.d_match = bool.Parse(dr[Rowd_match].ToString());

		if (dr[Rowd_exist].ToString() != "")
			this.d_exist = bool.Parse(dr[Rowd_exist].ToString());

		if (dr[RowFSTATUS].ToString() != "")
			this.FSTATUS = dr[RowFSTATUS].ToString();

		if (dr[RowLOCNO].ToString() != "")
			this.LOCNO = dr[RowLOCNO].ToString();

		if (dr[Rowd_accno].ToString() != "")
			this.d_accno = dr[Rowd_accno].ToString();

		if (dr[Rowd_doctype].ToString() != "")
			this.d_doctype = dr[Rowd_doctype].ToString();

		if (dr[Rowd_lasttran].ToString() != "")
			this.d_lasttran = DateTime.Parse(dr[Rowd_lasttran].ToString());
          }
          success = true;
        }
      }
      return success;
    }

    private bool SetClassPropertiesListFromDataSet(DataSet resultDS)
    {
      bool success = false;
      if (resultDS.Tables[0] != null)
      {
        if (resultDS.Tables[0].Rows.Count > 0)
        {
          foreach (DataRow dr in resultDS.Tables[0].Rows)
          {
            DOReportsFoldersReadyForMerging ReportsFoldersReadyForMerging = new DOReportsFoldersReadyForMerging();
			
					if (dr[Rowtuser].ToString() != "")
			ReportsFoldersReadyForMerging.tuser = dr[Rowtuser].ToString();

		if (dr[RowFILENO].ToString() != "")
			ReportsFoldersReadyForMerging.FILENO = dr[RowFILENO].ToString();

		if (dr[Rowd_id].ToString() != "")
			ReportsFoldersReadyForMerging.d_id = dr[Rowd_id].ToString();

		if (dr[Rowd_folder].ToString() != "")
			ReportsFoldersReadyForMerging.d_folder = dr[Rowd_folder].ToString();

		if (dr[Rowd_loc].ToString() != "")
			ReportsFoldersReadyForMerging.d_loc = dr[Rowd_loc].ToString();

		if (dr[RowILPNO].ToString() != "")
			ReportsFoldersReadyForMerging.ILPNO = dr[RowILPNO].ToString();

		if (dr[Rowa_code].ToString() != "")
			ReportsFoldersReadyForMerging.a_code = dr[Rowa_code].ToString();

		if (dr[Rowa_desc].ToString() != "")
			ReportsFoldersReadyForMerging.a_desc = dr[Rowa_desc].ToString();

		if (dr[Rowa_from].ToString() != "")
			ReportsFoldersReadyForMerging.a_from = dr[Rowa_from].ToString();

		if (dr[Rowa_to].ToString() != "")
			ReportsFoldersReadyForMerging.a_to = dr[Rowa_to].ToString();

		if (dr[Rowd_status].ToString() != "")
			ReportsFoldersReadyForMerging.d_status = dr[Rowd_status].ToString();

		if (dr[Rowd_match].ToString() != "")
			ReportsFoldersReadyForMerging.d_match = bool.Parse(dr[Rowd_match].ToString());

		if (dr[Rowd_exist].ToString() != "")
			ReportsFoldersReadyForMerging.d_exist = bool.Parse(dr[Rowd_exist].ToString());

		if (dr[RowFSTATUS].ToString() != "")
			ReportsFoldersReadyForMerging.FSTATUS = dr[RowFSTATUS].ToString();

		if (dr[RowLOCNO].ToString() != "")
			ReportsFoldersReadyForMerging.LOCNO = dr[RowLOCNO].ToString();

		if (dr[Rowd_accno].ToString() != "")
			ReportsFoldersReadyForMerging.d_accno = dr[Rowd_accno].ToString();

		if (dr[Rowd_doctype].ToString() != "")
			ReportsFoldersReadyForMerging.d_doctype = dr[Rowd_doctype].ToString();

		if (dr[Rowd_lasttran].ToString() != "")
			ReportsFoldersReadyForMerging.d_lasttran = DateTime.Parse(dr[Rowd_lasttran].ToString());

            this.ReportsFoldersReadyForMergings.Add(ReportsFoldersReadyForMerging);
          }
          success = true;
        }
      }
      return success;
    }
    #endregion

    #region Class Support Methods
    #endregion
  }
}
